.card {
  position: absolute;
  border-radius: 5px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
  padding: 10px; /* 仅用于内容，box-sizing: border-box 可确保尺寸一致 */
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  cursor: pointer;
  overflow: visible; 
  word-break: break-word;
  min-width: 160px;
  min-height: 80px;
  resize: both;
  box-sizing: border-box;
  margin: 0;
}

.card:hover {
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

/* 改进选中样式 */
.card.selected {
  box-shadow: 0 0 0 2px #4285f4, 0 4px 8px rgba(0, 0, 0, 0.2);
  z-index: 10;
}

.card.selected:hover {
  box-shadow: 0 0 0 2px #4285f4, 0 6px 12px rgba(0, 0, 0, 0.3);
}

/* 添加卡片拖动时的样式 */
.card.dragging {
  opacity: 0.9;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
  z-index: 15 !important; /* 确保拖动中的卡片总是在最上层 */
  transition: none !important; /* 拖动时禁用过渡效果 */
  cursor: grabbing !important;
}

/* 目标卡片高亮样式 */
.card.targeted {
  border: 3px dashed #4285f4 !important;
  box-shadow: 0 0 10px rgba(66, 133, 244, 0.8) !important;
}

/* 卡片工具栏样式 */
.card-toolbar {
  position: absolute;
  top: -40px;
  left: 0;
  background-color: white;
  border-radius: 4px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
  padding: 4px;
  display: flex;
  flex-direction: row;
  align-items: center;
  z-index: 20;
}

/* 颜色选择器样式 */
.color-options {
  display: flex;
  gap: 4px;
}

.color-option {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  cursor: pointer;
  border: 1px solid rgba(0, 0, 0, 0.1);
}

.color-option:hover {
  transform: scale(1.2);
  box-shadow: 0 0 3px rgba(0, 0, 0, 0.3);
}

.color-option.active {
  border: 2px solid #4285f4;
}

/* 卡片大小调整提示样式 */
.resize-hint {
  position: absolute;
  bottom: 2px;
  right: 2px;
  width: 12px;
  height: 12px;
  background-color: rgba(0, 0, 0, 0.2);
  border-radius: 0 0 4px 0;
  cursor: se-resize !important;
  opacity: 0;
  transition: opacity 0.2s, background-color 0.2s;
  pointer-events: auto; /* 确保可以接收鼠标事件 */
}

.card:hover .resize-hint {
  opacity: 1;
}

.resize-hint:hover {
  background-color: rgba(66, 133, 244, 0.6);
}

/* 调整大小时的状态 */
.card.resizing {
  user-select: none;
  z-index: 15 !important;
}

.card.resizing .resize-hint {
  opacity: 1;
  background-color: rgba(66, 133, 244, 0.8);
}

.card-content {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  overflow-wrap: break-word; 
  white-space: pre-wrap; 
  padding: 0;
  margin: 0;
}

.card-editor {
  width: 100%;
  height: 100%;
  border: none;
  background: transparent;
  resize: none;
  font-family: inherit;
  font-size: inherit;
  text-align: center;
  outline: none;
  padding: 0;
  margin: 0;
  white-space: pre-wrap; 
  overflow: hidden; 
}

.card-editor.readonly {
  user-select: none;
  pointer-events: none;
  color: inherit;
}

/* 移除只读状态下的文本区域默认样式 */
.card-editor.readonly:focus {
  outline: none;
  box-shadow: none;
}

/* 修改颜色提示样式以更明显 */
.color-hint {
  position: absolute;
  bottom: -25px;
  left: 50%;
  transform: translateX(-50%);
  background-color: rgba(0, 0, 0, 0.7);
  color: white;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 12px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s;
  white-space: nowrap;
  z-index: 100;
}

.card.selected .color-hint {
  opacity: 1;
}

/* 确保卡片在获取焦点时有合适的样式但不显示默认的焦点轮廓 */
.card:focus {
  outline: none;
}